using System.Collections.Generic;

namespace DeclarativeTest.Core.Support
{
	/// <summary>
	/// Simple implementation of <see cref="IHierarchicalDataProvider"/>
	/// </summary>
	public class DataProviderDictionary : IHierarchicalDataProvider
	{
		private readonly IDataProvider _parentDataProvider;
		private readonly IDictionary<string,object> _dictionary;

		#region .ctor

		/// <summary>
		/// Initializes a new instance of the <see cref="T:System.Object"/> class.
		/// </summary>
		public DataProviderDictionary( IDictionary<string,object> dictionary )
		{
			_dictionary = dictionary;
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="T:System.Object"/> class.
		/// </summary>
		public DataProviderDictionary( IDataProvider parentDataProvider, IDictionary<string,object> dictionary )
		{
			_parentDataProvider = parentDataProvider;
			_dictionary = dictionary;
		}

		#endregion

		#region Implementation of IDataProvider

		/// <summary>
		/// Properties.
		/// </summary>
		public IDictionary<string,object> Properties
		{
			get { return _dictionary; }
		}

		#endregion

		#region Implementation of IHierarchicalDataProvider

		/// <summary>
		/// Parent <see cref="IDataProvider"/>
		/// </summary>
		public IDataProvider ParentDataProvider
		{
			get { return _parentDataProvider; }
		}

		#endregion
	}
}